package com.tianji.learning.controller;

import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.query.QuestionAdminPageQuery;
import com.tianji.learning.domain.vo.QuestionAdminVO;
import com.tianji.learning.service.IInteractionQuestionService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * ClassName: AdminQuestionController
 * Package: com.tianji.learning.controller
 * Description:
 *
 * @Author 陈宽
 * @Create 2025/7/2 19:34
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/admin/questions")
public class AdminQuestionController {
    private final IInteractionQuestionService questionService;
    @GetMapping("page")
    public PageDTO<QuestionAdminVO> queryQuestions(QuestionAdminPageQuery query) {
        return questionService.questionAdminPage(query);
    }
    @GetMapping("{id}")
    public QuestionAdminVO queryQuestionById(@PathVariable("id") Long id) {
        return questionService.getAdminVoById(id);
    }
    @PutMapping("/{id}/hidden/{hidden}")
    public void updateQuestionHidden(@PathVariable("id") Long id, @PathVariable("hidden") Boolean hidden) {
        questionService.updateQuestionHidden(id, hidden);
    }
}
